<?xml version="1.0" encoding="utf-8" ?>
<sqlMap namespace="TUser" xmlns="http://ibatis.apache.org/mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<alias>
    <typeAlias alias="TUser" type="EIA.Basic.Model.TUser, EIA.Basic.Model" />
</alias>

<resultMaps>
<resultMap id="select-tuser-result" class="TUser">
<constructor>
    <argument argumentName="login_id" column="login_id"/>
    <argument argumentName="login_pwd" column="login_pwd"/>
    <argument argumentName="login_avalible" column="login_avalible"/>
    <argument argumentName="stf_id" column="stf_id"/>
    <argument argumentName="is_admin" column="is_admin"/>
</constructor>
<!--
    <result property="LoginId" column="login_id"/>
    <result property="LoginPwd" column="login_pwd"/>
    <result property="LoginAvalible" column="login_avalible"/>
    <result property="StfId" column="stf_id"/>
    <result property="IsAdmin" column="is_admin"/>
-->
</resultMap>
</resultMaps>

<statements>
<sql id="sql_TUser_where_pk">
WHERE login_id=#LoginId#
</sql>

<sql id="sql_TUser_where_cv">
<dynamic prepend="WHERE">
    <isPropertyAvailable property="LoginId" prepend="AND">login_id LIKE concat('%', #LoginId#, '%')</isPropertyAvailable>
    <isPropertyAvailable property="LoginPwd" prepend="AND">login_pwd LIKE concat('%', #LoginPwd#, '%')</isPropertyAvailable>
    <isPropertyAvailable property="LoginAvalible" prepend="AND">login_avalible=#LoginAvalible#</isPropertyAvailable>
  <isPropertyAvailable property="StfId" prepend="AND">stf_id=#StfId#</isPropertyAvailable>
  <isPropertyAvailable property="IsAdmin" prepend="AND">is_admin=#IsAdmin#</isPropertyAvailable>
</dynamic>
</sql>

<sql id="sql_TUser_set_cols">
<dynamic prepend="SET">
    <isPropertyAvailable property="LoginPwd" prepend=",">login_pwd=#LoginPwd#</isPropertyAvailable>
    <isPropertyAvailable property="LoginAvalible" prepend=",">login_avalible=#LoginAvalible#</isPropertyAvailable>
    <isPropertyAvailable property="StfId" prepend=",">stf_id=#StfId#</isPropertyAvailable>
    <isPropertyAvailable property="IsAdmin" prepend=",">is_admin=#IsAdmin#</isPropertyAvailable>
</dynamic>
</sql>

<select id="SelectTUser" parameterClass="" resultMap="TUser.select-tuser-result">
SELECT *
FROM t_user
<include refid="sql_TUser_where_pk"/><!--where-->
</select>

<select id="SelectTUser_CV" parameterClass="System.Collections.IDictionary" resultMap="TUser.select-tuser-result">
SELECT *
FROM t_user
<include refid="sql_TUser_where_cv"/><!--where-->
</select>

<insert id="InsertTUser" parameterClass="TUser">
<!--pre selectKey place-->
INSERT INTO t_user(
<dynamic prepend=" ">
    <isPropertyAvailable property="LoginId" prepend=",">login_id</isPropertyAvailable>
    <isPropertyAvailable property="LoginPwd" prepend=",">login_pwd</isPropertyAvailable>
    <isPropertyAvailable property="LoginAvalible" prepend=",">login_avalible</isPropertyAvailable>
    <isPropertyAvailable property="StfId" prepend=",">stf_id</isPropertyAvailable>
    <isPropertyAvailable property="IsAdmin" prepend=",">is_admin</isPropertyAvailable>
</dynamic>
)VALUES(
<dynamic prepend=" ">
    <isPropertyAvailable property="LoginId" prepend=",">#LoginId#</isPropertyAvailable>
    <isPropertyAvailable property="LoginPwd" prepend=",">#LoginPwd#</isPropertyAvailable>
    <isPropertyAvailable property="LoginAvalible" prepend=",">#LoginAvalible#</isPropertyAvailable>
    <isPropertyAvailable property="StfId" prepend=",">#StfId#</isPropertyAvailable>
    <isPropertyAvailable property="IsAdmin" prepend=",">#IsAdmin#</isPropertyAvailable>
</dynamic>
)
<!--post selectKey place-->
</insert>

<update id="UpdateTUser" parameterClass="System.Collections.IDictionary">
UPDATE t_user
<include refid="sql_TUser_set_cols"/><!--set-->
<include refid="sql_TUser_where_pk"/><!--where-->
</update>

<delete id="DeleteTUser" parameterClass="">
DELETE FROM t_user
<include refid="sql_TUser_where_pk"/><!--where-->
</delete>

<statement id="DeleteTUser_CV" parameterClass="TUser">
DELETE FROM t_user
<include refid="sql_TUser_where_cv"/><!--where-->
</statement>

<delete id="ClearTUser">
DELETE FROM t_user
</delete>
</statements>
</sqlMap>